home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Programmation / Gooey1.3.1 / C++ Templates / mmCommon.h < prev    next >
Text File  |  1995-01-31  |  48KB  |  1,449 lines

  1. $$Message MM Precompile headers, mmHeaders.cp
  2. $$File mmHeaders.cp
  3. /*  $CopyRight$ */
  4. /*   mmHeaders                    Type definitions
  5.  
  6.     Name:  mmHeaders.cp
  7.     Function:  Precompile headers for Marksman¬ code.
  8.     History: $Date$ Original by $Author$
  9.  
  10.     To add a header, change its "#if 0" to "#if 1".
  11.     To remove a header, change its "#if 1" to "#if 0".
  12.     
  13.     THINK C NOTE: You must used 'relaxed ANSI' to do the precompile, strict ANSI will
  14.             generate errors.
  15.     
  16.  */
  17.  
  18. #ifndef _H_MacHeaders
  19. #define _H_MacHeaders
  20.  
  21.  
  22. #if defined(THINK_C) || defined(THINK_CPLUS)
  23. #ifndef __SC__
  24.  
  25. // set this to 0 (zero) to retain full prototypes
  26. // set this to 1 (one) for "simplified" prototypes
  27. #define SIMPLIFY_PROTOTYPES        0
  28.  
  29.  
  30. // prototype checking level
  31. #if SIMPLIFY_PROTOTYPES
  32.     #if !__option(check_ptrs)
  33.         #undef SIMPLIFY_PROTOTYPES
  34.     #endif
  35.     #pragma options(!check_ptrs)
  36. #else
  37.     #if __option(check_ptrs)
  38.         #undef SIMPLIFY_PROTOTYPES
  39.     #endif
  40.     #pragma options(check_ptrs)
  41. #endif
  42.  
  43. #endif
  44. #else
  45.  
  46. #if defined(THINK_C) || defined(THINK_CPLUS)
  47. #pragma pointers_in_D0        //    required for c-style toolbox glue function: c2pstr and p2cstr
  48.                             //    the inverse operation (pointers_in_A0) is performed at the end ...
  49. #endif
  50.  
  51. //
  52. //    To allow the use of ToolBox calls which have now become obsolete on PowerPC, but
  53. //    which are still needed for System 6 applications, we need to #define OBSOLETE.  If
  54. //    your application will never use these calls then you can comment out this #define.
  55. //
  56.  
  57. #define OBSOLETE    1
  58.  
  59. //    Metrowerks-specific Toolbox definitions
  60. //
  61. //    These definitions are commonly used but not in Apple's headers. We define
  62. //    them in our precompiled header so we can use the Apple headers without modification.
  63. //
  64.  
  65. #define PtoCstr        p2cstr
  66. #define CtoPstr        c2pstr
  67. #define CtoPString    c2pstr
  68. #define PtoCString    p2cstr
  69.  
  70. #if defined(THINK_C) || defined(THINK_CPLUS)
  71. #define Length(s)    (*(unsigned char *)(s))
  72. #endif
  73. #define topLeft(r)    (((Point *) &(r))[0])
  74. #define botRight(r)    (((Point *) &(r))[1])
  75.  
  76. #define TRUE        true
  77. #define FALSE        false
  78.  
  79. //    We need to include this file 
  80. #include <MixedMode.h>
  81. long GetCurrentA5(void)
  82.  ONEWORDINLINE(0x200D);
  83.  
  84. #if defined(THINK_C) || defined(THINK_CPLUS)
  85. #pragma pointers_in_A0        //    required for c-style toolbox glue function: c2pstr and p2cstr
  86. #endif
  87. #endif
  88.  
  89.     #if 0
  90.         #include <ActionAtomIntf.h>
  91.     #endif
  92.     #if 0
  93.         #include <ADSP.h>
  94.     #endif
  95.  
  96.     #if 1
  97.         #include <AEObjects.h>
  98.     #endif
  99.     #if 1
  100.         #include <AEPackObject.h>
  101.     #endif
  102.  
  103.     #if 0
  104.         #include <AERegistry.h>
  105.     #endif
  106.     
  107.     #if 0
  108.         #include <AIFF.h>
  109.     #endif
  110.  
  111.     #if 1
  112.         #ifdef __APPLETALK__
  113.             #include <Aliases.h>
  114.         #else
  115.             #define __APPLETALK__            // suppress unnecessary #include <AppleTalk.h>
  116.             #include <Aliases.h>
  117.             #undef __APPLETALK__
  118.         #endif
  119.     #endif
  120.  
  121.     #if 1
  122.         #ifdef __EPPC__
  123.             #include <AppleEvents.h>
  124.         #else
  125.             #define __EPPC__                // suppress unnecessary #include <EPPC.h>
  126.             #include <AppleEvents.h>
  127.             #undef __EPPC__
  128.         #endif
  129.     #endif
  130.  
  131.     #if 0
  132.         #include <AppleTalk.h>
  133.     #endif
  134.  
  135.     #if 0
  136.         #ifdef __TRAPS__
  137.             #include <Balloons.h>
  138.         #else
  139.             #define __TRAPS__                // suppress unnecessary #include <Traps.h>
  140.             #define _Pack14 0xA830            // (well, mostly unnecessary...)
  141.             #include <Balloons.h>
  142.             #undef _Pack14
  143.             #undef __TRAPS__
  144.         #endif
  145.     #endif
  146.  
  147. #if defined(THINK_C) || defined(THINK_CPLUS)
  148.     #if 1
  149.         #include <BDC.h>
  150.     #endif
  151. #endif
  152.  
  153.     #if 0
  154.         #include <CommResources.h>
  155.     #endif
  156.     #if 0
  157.         #include <Components.h>
  158.     #endif
  159.     #if 0
  160.         #include <Connections.h>
  161.     #endif
  162.     #if 0
  163.         #include <ConnectionTools.h>
  164.     #endif
  165.  
  166.     #if 1
  167.         #include <Controls.h>
  168.     #endif
  169.  
  170.     #if 0
  171.         #include <CRMSerialDevices.h>
  172.     #endif
  173.     #if 0
  174.         #include <CTBUtilities.h>
  175.     #endif
  176.     #if 0
  177.         #include <DatabaseAccess.h>
  178.     #endif
  179.  
  180.     #if 1
  181.         #include <Desk.h>
  182.     #endif
  183.  
  184.     #if 0
  185.         #include <DeskBus.h>
  186.     #endif
  187.  
  188.     #if 1
  189.         #include <Devices.h>
  190.     #endif
  191.     #if 1
  192.         #include <Dialogs.h>
  193.     #endif
  194.     #if 1
  195.         #include <DiskInit.h>
  196.     #endif
  197.  
  198.     #if 0
  199.         #include <Disks.h>
  200.     #endif
  201.     #if 0
  202.         #include <Editions.h>
  203.     #endif
  204.     #if 0
  205.         #include <ENET.h>
  206.     #endif
  207.     #if 0
  208.         #include <EPPC.h>
  209.     #endif
  210.  
  211.     #if 1
  212.         #include <Errors.h>
  213.     #endif
  214.     #if 1
  215.         #include <Events.h>
  216.     #endif
  217.     #if 1
  218.         #include <Files.h>
  219.     #endif
  220.  
  221.     #if 0
  222.         #include <FileTransfers.h>
  223.     #endif
  224.     #if 0
  225.         #include <FileTransferTools.h>
  226.     #endif
  227.     #if 0
  228.         #include <Finder.h>
  229.     #endif
  230.     #if 0
  231.         #include <FixMath.h>
  232.     #endif
  233.  
  234.     #if 1
  235.         #include <Folders.h>
  236.     #endif
  237.     #if 1
  238.         #include <Fonts.h>
  239.     #endif
  240.     #if 1
  241.         #include <GestaltEqu.h>
  242.     #endif
  243.  
  244.     #if 0
  245.         #include <Graf3D.h>
  246.     #endif
  247.     #if 0
  248.         #include <HyperXCmd.h>
  249.     #endif
  250.  
  251.     #if 1
  252.         #include <Icons.h>
  253.     #endif
  254.  
  255.     #if 0
  256.         #include <ImageCodec.h>
  257.     #endif
  258.     #if 0
  259.         #include <ImageCompression.h>
  260.     #endif
  261.     #if 0
  262.         #include <Language.h>
  263.     #endif
  264.  
  265.     #if 1
  266.         #include <Lists.h>
  267.     #endif
  268.  
  269.     #if 0
  270.         #include <MediaHandlers.h>
  271.     #endif
  272.  
  273.     #if 1
  274.         #include <Memory.h>
  275.     #endif
  276.     #if 1
  277.         #include <Menus.h>
  278.     #endif
  279.  
  280.     #if 0
  281.         #include <MIDI.h>
  282.     #endif
  283.     #if 0
  284.         #include <Movies.h>
  285.     #endif
  286.     #if 0
  287.         #include <MoviesFormat.h>
  288.     #endif
  289.         
  290.     #if 1
  291.         #include <Notification.h>
  292.     #endif
  293.     #if 1
  294.         #include <OSEvents.h>
  295.     #endif
  296.     #if 1
  297.         #include <OSUtils.h>
  298.     #endif
  299.     #if 1
  300.         #include <Packages.h>
  301.     #endif
  302.  
  303.     #if 0
  304.         #include <Palette.h>
  305.     #endif
  306.     #if 0
  307.         #include <Palettes.h>
  308.     #endif
  309.     #if 0
  310.         #include <Picker.h>
  311.     #endif
  312.     #if 0
  313.         #include <PictUtil.h>
  314.     #endif
  315.     #if 0
  316.         #include <Power.h>
  317.     #endif
  318.     #if 0
  319.         #include <PPCToolBox.h>
  320.     #endif
  321. #if defined(THINK_C) || defined(THINK_CPLUS)
  322.     #if 0
  323.         #include <Printing.h>
  324.     #endif
  325.  
  326.     #if 1
  327.         #include <PrintTraps.h>
  328.     #endif
  329. #else
  330.     #if 1
  331.         #include <Printing.h>
  332.     #endif
  333. #endif
  334.  
  335.     #if 0
  336.         #include <Processes.h>
  337.     #endif
  338.  
  339.     #if 1
  340.         #include <QDOffscreen.h>
  341.     #endif
  342.     #if 1
  343.         #include <Quickdraw.h>
  344.     #endif
  345.  
  346.     #if 0
  347.         #include <QuickTimeComponents.h>
  348.     #endif
  349.     
  350.     #if 1
  351.         #include <Resources.h>
  352.     #endif
  353.  
  354.     #if 0
  355.         #include <Retrace.h>
  356.     #endif
  357.     #if 0
  358.         #include <ROMDefs.h>
  359.     #endif
  360.     #if 0
  361.         #include <SANE.h>
  362.     #endif
  363.  
  364.     #if 1
  365.         #include <Scrap.h>
  366.     #endif
  367.  
  368.     #if 0
  369.         #include <Script.h>
  370.     #endif
  371.     #if 0
  372.         #include <SCSI.h>
  373.     #endif
  374.  
  375.     #if 1
  376.         #include <SegLoad.h>
  377.     #endif
  378.  
  379.     #if 0
  380.         #include <Serial.h>
  381.     #endif
  382.     #if 0
  383.         #include <ShutDown.h>
  384.     #endif
  385.     #if 0
  386.         #include <Slots.h>
  387.     #endif
  388.  
  389.     #if 1
  390.         #include <Sound.h>
  391.     #endif
  392.  
  393.     #if 0
  394.         #include <SoundInput.h>
  395.     #endif
  396.  
  397.     #if 1
  398.         #include <StandardFile.h>
  399.     #endif
  400.  
  401.     #if 0
  402.         #include <Start.h>
  403.     #endif
  404.     #if 0
  405.         #include <SysEqu.h>
  406.     #endif
  407.     #if 0
  408.         #include <Terminals.h>
  409.     #endif
  410.     #if 0
  411.         #include <TerminalTools.h>
  412.     #endif
  413.  
  414.     #if 1
  415.         #include <TextEdit.h>
  416.     #endif
  417.     #if 1
  418.         #include <Timer.h>
  419.     #endif
  420.     #if 1
  421.         #include <ToolUtils.h>
  422.     #endif
  423.     #if 1
  424.         #include <Types.h>
  425.     #endif
  426.  
  427.     #if 0
  428.         #include <Values.h>
  429.     #endif
  430.     #if 0
  431.         #include <Video.h>
  432.     #endif
  433.  
  434.     #if 1
  435.         #include <Windows.h>
  436.     #endif
  437.  
  438. #if defined(THINK_C) || defined(THINK_CPLUS)
  439.     #if 1
  440.         #include <pascal.h>
  441.     #endif
  442.  
  443.     #if 1
  444.         #include <asm.h>
  445.     #endif
  446. #else
  447.     #if 0
  448.         #include <asm.h>
  449.     #endif
  450. #endif
  451.  
  452. #if defined(THINK_C) || defined(THINK_CPLUS)
  453.     #if 1 && !defined(__cplusplus)
  454.         #include <LoMem.h>
  455.     #endif
  456.  
  457.     #if 1
  458.         #include <THINK.h>
  459.     #endif
  460. #else
  461.     #if 1
  462.         #include <LowMem.h>
  463.     #endif
  464. #endif
  465.  
  466.     #if 0
  467.         #include <Traps.h>
  468.     #endif
  469.  
  470.  
  471. #if defined(THINK_C) || defined(THINK_CPLUS)
  472. #ifndef __SC__
  473.  
  474. // restore "Check Pointer Types" to previous setting
  475. #if SIMPLIFY_PROTOTYPES
  476.     #pragma options(check_ptrs)
  477. #elif defined(SIMPLIFY_PROTOTYPES)
  478.     #pragma options(!check_ptrs)
  479. #endif
  480. #undef SIMPLIFY_PROTOTYPES
  481.  
  482. #endif
  483. #endif
  484. #endif
  485.  
  486.  
  487. /* Defined to get around qd. differences */
  488. #if defined(THINK_C) || defined(THINK_CPLUS)
  489. #define            screenRect        screenBits
  490. #define            QDPort                thePort
  491. #else
  492. #define            screenRect        qd.screenBits
  493. #define            QDPort                qd.thePort
  494. #endif
  495.  
  496. #include "mmTypes$Prototype.name$.h"                /* Marksman types */
  497. #include "Types$Prototype.name$.h"                    /* User types */
  498.  
  499. /* ======================================================= */
  500. /* ======================================================= */
  501. $$CloseFile
  502. $$Message MM Types, mm:mmTypes$Prototype.name$.h
  503. $$File mm:mmTypes$Prototype.name$.h
  504. /*  $CopyRight$ */
  505. /*   mmTypes$Prototype.name$                        Type definitions
  506.  
  507.     Name:  mmTypes$Prototype.name$.h
  508.     Function:  Type definitions for Marksman¬ code.
  509.     History: $Date$ Original by $Author$
  510.  
  511. */
  512.  
  513.  
  514. /* ======================================================= */
  515. /* ======================================================= */
  516.  
  517. /* Basic definitions */
  518. #define NIL                                0L            /* Used for empty pointers and handles */ 
  519.  
  520. /* User event definitions */
  521. #define UserEvent_None                     0            /* No user events available */
  522. #define UserEvent_Open_Window             1            /* Open Window or modeless dialog */
  523. #define UserEvent_Close_Window             2            /* Close Window or modeless dialog */
  524. #define UserEvent_Activate_Window         3            /* Activate Window or modeless dialog */
  525. #define UserEvent_Deactivate_Window     4            /* Deactivate Window or modeless dialog */
  526. /* IDs 0 to 999 reserved for Marksman¬, all others available for special use */
  527.  
  528. /* Menu list resource IDs */
  529. $$Loop Menus
  530. #define Res_Menu_$Menu.name$     $Menu.ID$            /* Menu resource ID, $Menu.FullName$ */
  531. $$Loop MenuItems
  532. #define MItem_$MenuItem.name$     $MenuItem.ID$
  533. $$EndLoop MenuItems
  534.  
  535. $$EndLoop Menus
  536.  
  537. $$Loop HierMenus
  538. #define Res_Menu_$Menu.name$     $Menu.ID$            /* Hier Menu resource ID, $Menu.FullName$ */
  539. $$Loop MenuItems
  540. #define MItem_$MenuItem.name$     $MenuItem.ID$
  541. $$EndLoop MenuItems
  542.  
  543. $$EndLoop HierMenus
  544.  
  545. /* Window resource IDs, also controls grouped with the appropiate window */
  546.  
  547. $$Loop Alerts
  548. /* Variables for the alert titled  "$Worksheet.FullName$" */
  549. #define ResA_$Worksheet.name$        $Worksheet.ID$            /* Alert, $Worksheet.FullName$ */
  550. $$Loop Control.type = Button
  551. #define ResA_$Control.name$    $Control.ItemID$            /* ...Button, $Control.FullName$ */
  552. $$EndLoop
  553. $$Loop Control.type = StaticText
  554. $$if Control.StandardText
  555. #define ResA_$Control.name$    $Control.ItemID$            /* ...Static Text, $Control.FullName$ */
  556. $$endif
  557. $$if Control.SpecialText
  558. #define sResA_$Control.name$    $Control.StringID$        /* ...Static Text, $Control.FullName$ */
  559. $$endif
  560. $$EndLoop
  561. $$Loop Control.type = Icon
  562. #define ResA_$Control.name$    $Control.ItemID$            /* ...Icon, $Control.FullName$ */
  563. #define ResA_N_$Control.name$    $Control.NormalID$
  564. #define ResA_H_$Control.name$    $Control.HilitedID$
  565. $$EndLoop
  566. $$Loop Control.type = Picture
  567. #define ResA_$Control.name$    $Control.ItemID$            /* ...Picture, $Control.FullName$ */
  568. $$if Control.NonGraphic
  569. #define ResA_N_$Control.name$    $Control.NormalID$
  570. $$endif
  571. $$EndLoop
  572. $$Loop Control.type = UButton
  573. #define ResA_$Control.name$    $Control.ItemID$            /* ...Plugin button, $Control.FullName$ */
  574. #define sResA_$Control.name$    $Control.StringID$
  575. #define ResA_N_$Control.name$    $Control.NormalID$
  576. #define ResA_H_$Control.name$    $Control.HilitedID$
  577. $$EndLoop
  578. $$Loop Control.type = HotRect
  579. #define ResA_$Control.name$    $Control.ItemID$            /* ...HotSpot, $Control.FullName$ */
  580. #define sResA_$Control.name$    $Control.StringID$
  581. $$EndLoop
  582. $$Loop Control.type = Sicn
  583. #define ResA_$Control.name$    $Control.ItemID$            /* ...Sicn, $Control.FullName$ */
  584. #define ResA_N_$Control.name$    $Control.NormalID$
  585. #define ResA_H_$Control.name$    $Control.HilitedID$
  586. $$EndLoop
  587.  
  588. $$EndLoop Alerts
  589. $$Loop Dialogs
  590. /* Variables for the Dialog titled  "$Worksheet.FullName$" */
  591. #define ResD_$Worksheet.name$        $Worksheet.ID$            /* Dialog, $Worksheet.FullName$ */
  592. $$Loop Control.type = Button
  593. #define ResD_$Control.name$    $Control.ItemID$            /* ...Button, $Control.FullName$ */
  594. $$EndLoop
  595. $$Loop Control.type = Checkbox
  596. #define ResD_$Control.name$    $Control.ItemID$            /* ...Checkbox, $Control.FullName$ */
  597. $$EndLoop
  598. $$Loop Control.type = Radio
  599. #define ResD_$Control.name$    $Control.ItemID$            /* ...Radio, $Control.FullName$ */
  600. $$EndLoop
  601. $$Loop Control.type = StaticText
  602. $$if Control.StandardText
  603. #define ResD_$Control.name$    $Control.ItemID$            /* ...Static Text, $Control.FullName$ */
  604. $$endif
  605. $$if Control.SpecialText
  606. #define sResD_$Control.name$    $Control.StringID$            /* ...Static Text, $Control.FullName$ */
  607. $$endif
  608. $$EndLoop
  609. $$Loop Control.type = Icon
  610. #define ResD_$Control.name$    $Control.ItemID$            /* ...Icon, $Control.FullName$ */
  611. #define ResD_N_$Control.name$    $Control.NormalID$
  612. #define ResD_H_$Control.name$    $Control.HilitedID$
  613. $$EndLoop
  614. $$Loop Control.type = Picture
  615. #define ResD_$Control.name$    $Control.ItemID$            /* ...Picture, $Control.FullName$ */
  616. $$if Control.NonGraphic
  617. #define ResD_N_$Control.name$    $Control.NormalID$
  618. $$endif
  619. $$EndLoop
  620. $$Loop Control.type = EditText
  621. #define ResD_$Control.name$    $Control.ItemID$            /* ...Edit Text, $Control.FullName$ */
  622. #define sResD_$Control.name$    $Control.StringID$            /* ...Edit Text, $Control.FullName$ */
  623. $$EndLoop
  624. $$Loop Control.type = ScrollBar
  625. #define ResD_$Control.name$    $Control.ItemID$            /* ...ScrollBar, $Control.FullName$ */
  626. $$EndLoop
  627. $$Loop Control.type = UButton
  628. #define ResD_$Control.name$    $Control.ItemID$            /* ...Plugin button, $Control.FullName$ */
  629. #define sResD_$Control.name$    $Control.StringID$
  630. #define ResD_N_$Control.name$    $Control.NormalID$
  631. #define ResD_H_$Control.name$    $Control.HilitedID$
  632. $$EndLoop
  633. $$Loop Control.type = UToggle
  634. #define ResD_$Control.name$    $Control.ItemID$            /* ...Plugin toggle, $Control.FullName$ */
  635. #define sResD_$Control.name$    $Control.StringID$
  636. #define ResD_N_$Control.name$    $Control.NormalID$
  637. #define ResD_H_$Control.name$    $Control.HilitedID$
  638. $$EndLoop
  639. $$Loop Control.type = UGauge
  640. #define ResD_$Control.name$    $Control.ItemID$            /* ...Plugin gauge, $Control.FullName$ */
  641. #define sResD_$Control.name$    $Control.StringID$
  642. #define ResD_N_$Control.name$    $Control.NormalID$
  643. #define ResD_H_$Control.name$    $Control.HilitedID$
  644. $$EndLoop
  645. $$Loop Control.type = List
  646. #define sResD_$Control.name$    $Control.StringID$            /* ...List, $Control.FullName$ */
  647. $$EndLoop
  648. $$Loop Control.type = Popup
  649. #define ResD_$Control.name$    $Control.ItemID$            /* ...Popup menu, $Control.FullName$ */
  650. #define mResD_$Control.name$    $Control.MenuID$
  651. $$EndLoop
  652. $$Loop Control.type = Palette
  653. #define ResD_$Control.name$    $Control.ItemID$            /* ...Palette, $Control.FullName$ */
  654. #define ResD_N_$Control.name$    $Control.NormalID$
  655. $$EndLoop
  656. $$Loop Control.type = HotRect
  657. #define ResD_$Control.name$    $Control.ItemID$            /* ...HotSpot, $Control.FullName$ */
  658. #define sResD_$Control.name$    $Control.StringID$
  659. $$EndLoop
  660. $$Loop Control.type = Sicn
  661. #define ResD_$Control.name$    $Control.ItemID$            /* ...Sicn, $Control.FullName$ */
  662. #define ResD_N_$Control.name$    $Control.NormalID$
  663. #define ResD_H_$Control.name$    $Control.HilitedID$
  664. $$EndLoop
  665.  
  666. $$EndLoop Dialogs
  667. $$Loop Windows
  668. /* Variables for the Window titled  "$Worksheet.FullName$" */
  669. #define ResW_$Worksheet.name$    $Worksheet.ID$            /* Window, $Worksheet.FullName$ */
  670. $$Loop Control.type = Button
  671. #define ResC_$Control.name$    $Control.ID$            /* ...Button, $Control.FullName$ */
  672. $$EndLoop
  673. $$Loop Control.type = Checkbox
  674. #define ResC_$Control.name$    $Control.ID$            /* ...Checkbox, $Control.FullName$ */
  675. $$EndLoop
  676. $$Loop Control.type = Radio
  677. #define ResC_$Control.name$    $Control.ID$            /* ...Radio, $Control.FullName$ */
  678. $$EndLoop
  679. $$Loop Control.type = StaticText
  680. #define sResC_$Control.name$    $Control.StringID$    /* ...Static Text, $Control.FullName$ */
  681. $$EndLoop
  682. $$Loop Control.type = EditText
  683. #define sResC_$Control.name$    $Control.StringID$    /* ...Edit Text, $Control.FullName$ */
  684. $$EndLoop
  685. $$Loop Control.type = List
  686. #define ResC_$Control.name$    $Control.ID$            /* ...List, $Control.FullName$ */
  687. $$EndLoop
  688. $$Loop Control.type = HotRect
  689. #define ResC_$Control.name$    $Control.ID$            /* ...HotSpot, $Control.FullName$ */
  690. #define sResC_$Control.name$    $Control.StringID$
  691. $$EndLoop
  692. $$Loop Control.type = ScrollBar
  693. #define ResC_$Control.name$    $Control.ID$            /* ...ScrollBar, $Control.FullName$ */
  694. $$EndLoop
  695. $$Loop Control.type = Icon
  696. #define ResC_$Control.name$    $Control.ID$            /* ...Icon, $Control.FullName$ */
  697. #define ResC_N_$Control.name$    $Control.NormalID$
  698. #define ResC_H_$Control.name$    $Control.HilitedID$
  699. $$EndLoop
  700. $$Loop Control.type = Picture
  701. #define ResC_$Control.name$    $Control.ID$            /* ...Picture, $Control.FullName$ */
  702. #define ResC_N_$Control.name$    $Control.NormalID$
  703. $$EndLoop
  704. $$Loop Control.type = UButton
  705. #define ResC_$Control.name$    $Control.ID$            /* ...Plugin button, $Control.FullName$ */
  706. #define sResC_$Control.name$    $Control.StringID$
  707. #define ResC_N_$Control.name$    $Control.NormalID$
  708. #define ResC_H_$Control.name$    $Control.HilitedID$
  709. $$EndLoop
  710. $$Loop Control.type = UToggle
  711. #define ResC_$Control.name$    $Control.ID$            /* ...Plugin toggle, $Control.FullName$ */
  712. #define sResC_$Control.name$    $Control.StringID$
  713. #define ResC_N_$Control.name$    $Control.NormalID$
  714. #define ResC_H_$Control.name$    $Control.HilitedID$
  715. $$EndLoop
  716. $$Loop Control.type = UGauge
  717. #define ResC_$Control.name$    $Control.ID$            /* ...Plugin gauge, $Control.FullName$ */
  718. #define sResC_$Control.name$    $Control.StringID$
  719. #define ResC_N_$Control.name$    $Control.NormalID$
  720. #define ResC_H_$Control.name$    $Control.HilitedID$
  721. $$EndLoop
  722. $$Loop Control.type = Popup
  723. #define ResC_$Control.name$    $Control.ID$            /* ...Popup menu, $Control.FullName$ */
  724. #define mResC_$Control.name$    $Control.MenuID$
  725. $$EndLoop
  726. $$Loop Control.type = Palette
  727. #define ResC_$Control.name$    $Control.ID$            /* ...Palette, $Control.FullName$ */
  728. #define ResC_N_$Control.name$    $Control.NormalID$
  729. $$EndLoop
  730. $$Loop Control.type = Sicn
  731. #define ResC_$Control.name$    $Control.ID$            /* ...Sicn, $Control.FullName$ */
  732. #define ResC_N_$Control.name$    $Control.NormalID$
  733. #define ResC_H_$Control.name$    $Control.HilitedID$
  734. $$EndLoop
  735.  
  736. $$EndLoop Windows
  737.  
  738. $$Loop Sounds
  739. #define ResS_$Sound.name$    $Sound.ID$                    /* Sound, $Sound.FullName$ */
  740. $$EndLoop
  741.  
  742. /* ======================================================= */
  743.  
  744. typedef struct UserEventRec{                        /* User Event Record definition */
  745.     short    ID;                                        /* ID for the type of user event */
  746.     short    ID2;                                    /* Optionally used, 2nd ID, sometimes used */
  747.     long    Data1;                                    /* Optionally used, Extra data */
  748.     long    Data2;                                    /* Optionally used, Extra data */
  749.     Handle    theHandle;                                /* Optionally used, Handle */
  750.     struct UserEventRec    **Next;                        /* Handle of next event in the list */
  751. }UserEventRec,*UserEventPRec,**UserEventHRec;
  752.  
  753.  
  754. typedef struct WindowLocRec{                        /* Window location record for Prefs */
  755.     $$Loop ModelessDialogs
  756.     $$if Worksheet.SavePosition
  757.     Rect       Loc_$Worksheet.name$;                /* Top Left corner of window */
  758.     $$endif
  759.     $$EndLoop
  760.     $$Loop Windows
  761.     $$if Worksheet.SavePosition
  762.     Rect       Loc_$Worksheet.name$;                /* Top Left corner of window */
  763.     $$endif
  764.     $$EndLoop
  765.     short            Pad;                            /* Place holder for empty record */
  766. }WindowLocRec;
  767.  
  768.  
  769. typedef struct HasRec{                                /* Record for Gestalt checks */
  770.     Boolean            ColorQD;                        /* Flag for Color QuickDraw being available */
  771.     Boolean            FPU;                            /* Flag for Floating Point Math Chip being available */
  772.     Boolean            AppleEvents;                    /* Whether AppleEvents are available */
  773.     Boolean            AliasMgr;                        /* Whether AliasMgr is available */
  774.     Boolean            EditionMgr;                        /* Whether EditionMgr is available */
  775.     Boolean            NewStdFile;                        /* Whether HasNewStdFile is available */
  776.     Boolean            PPCToolbox;                        /* Whether PPCToolbox is available */
  777.     Boolean            QuickDraw32Bit;                    /* Whether 32Bit QuickDraw is available */
  778.     Boolean            Gestalt;                        /* Whether Gestalt is available */
  779. }HasRec;
  780.  
  781.  
  782. typedef struct FileRec{                                /* Record for reading and writing files */
  783.     SFTypeList        typeList;                        /* For use in opening files */
  784.     SFReply            Reply;                            /* For use in getting file names */
  785.     StandardFileReply    theStdFileReply;            /* For use in getting file names */
  786.     short            inputRefNum;                    /* For the input file */
  787.     short            outputRefNum;                    /* For the output file */
  788.     Str255             inputFileName;                    /* For the input file */
  789.     Str255             outputFileName;                    /* For the output file */
  790. }FileRec;
  791.  
  792.  
  793. typedef struct PrintingRec{                            /* Record for printing */
  794.     THPrint            hPrint;                            /* Printer record */
  795.     Boolean            PrinterIsOpen;                    /* Whether printer is open or not */
  796.     short            PageCount;                        /* For adding in page number */
  797.     short            LineCount;                        /* For printing */
  798.     short            PrinterVRes,PrinterHRes;        /* Printer resolution */
  799.     short            MaxPrintCharacters;                /* Max characters on one line */
  800.     short            MaxLines;                        /* Maximum lines in one page */
  801.     TPPrPort        pPrPort;                        /* Printer port */
  802.     TPrStatus        prStatus;                        /* Printing status */
  803.     short            CopyCount;                        /* Number of copies to do */
  804. }PrintingRec;
  805.  
  806. /* ======================================================= */
  807.  
  808. class CmmDisplay{                    /* The window, dialog, or alert */
  809.     public:    
  810.     Handle            ExtraDataHdl;            /* Not used by MM code, dedicated to user code */
  811.  
  812.     virtual void    Init(void);                /* Initialize the variables */
  813. };
  814.  
  815. class CmmWindow: public CmmDisplay{                /* The window */
  816.     public:    
  817.     Boolean            MultipleInstances;        /* True if allow multiple instances */
  818.  
  819.     virtual void    Init(void);                /* Initialize the window variables */
  820.     virtual void    Moved(Rect *OldRect,WindowPtr whichWindow);    /* The window was zoomed or resized */
  821.     virtual void    OpenExtras(Ptr theWS);
  822.     virtual void    CloseExtras(Ptr theWS);
  823.     virtual void    UpdateExtras(Ptr theWS);
  824.     virtual void    ActivateExtras(Boolean Do_An_Activate,Ptr theWS);
  825.     virtual void    HandleExtraButtons(Ptr theWS,ControlHandle theControl,short *UnHiliteValue);
  826.     virtual void    HandleExtraCheckboxes(Ptr theWS,ControlHandle theControl);
  827. };
  828.  
  829. class CmmModalDialog: public CmmDisplay{            /* The Modal Dialog */
  830.     public:
  831.     DialogPtr        theWindow;                /* Window pointer */
  832.     RGBColor        WindowBackColor;        /* Background window color */
  833.     Boolean            ExitDialog;                /* Flag to exit dialog */
  834.     
  835.     virtual void    Init(void);                /* Initialize the dialog variables */
  836.     virtual Boolean    FilterThisEvent(DialogPtr theDialog,EventRecord *theEvent,short *itemHit);
  837.     virtual void    FilterMouseDown(DialogPtr theDialog,EventRecord *theEvent,short *itemHit,Point MyPt);
  838.     virtual void    ExtraSetup(void);
  839.     virtual void    DoItemHit(short *itemHit,Boolean *ExitDialog);    /* Let user handle the item hit */
  840.     virtual void    Exit(void);                /* Exit the dialog */
  841. };
  842.  
  843. class CmmModelessDialog: public CmmDisplay{        /* The Modeless Dialog */
  844.     public:
  845.     DialogPtr        theWindow;                /* Window pointer */
  846.     RGBColor        WindowBackColor;        /* Background window color */
  847.     Boolean            ExitDialog;                /* Flag to exit dialog */
  848.     
  849.     virtual void    Init(void);                /* Initialize the dialog variables */
  850.     virtual void    Moved(Rect *OldRect,WindowPtr theWindow); /* Moved this window */
  851.     virtual void    UpdateExtras(void);        /* HOOK, allow user update code in */
  852.     virtual void    OpenExtras(void);        /* HOOK, allow user open code in */
  853.     virtual void    FilterTheHit(short *itemHit,EventRecord *myEvent); /* HOOK, filter events */
  854. };
  855.  
  856. class CmmAlert: public CmmDisplay{                    /* The Alert */
  857.     public:
  858.     DialogPtr        theWindow;                /* Window pointer */
  859.     Boolean            DidFirstTime;            /* Flag for first time thru the filter */
  860.     RGBColor        WindowBackColor;        /* Background window color */
  861.     
  862.     virtual void    Init(void);                /* Initialize the alert variables */
  863.     virtual void    HandleFirstTime(void);    /* Handle setup necessary for first time in */
  864.     virtual void    DoFirstTime(void);        /* HOOK, Handle setup necessary for first time in */
  865.     virtual Boolean    FilterThisEvent(DialogPtr theDialog,EventRecord *theEvent,short *itemHit);
  866.     virtual void    DoItemHit(short itemHit);    /* HOOK, Handle setup necessary for first time in */
  867.     virtual void    BringUpAlert(void);
  868. };
  869.  
  870. /* ======================================================= */
  871.  
  872. $$Loop Alerts
  873. /* Class for the alert titled  "$Worksheet.FullName$" */
  874. class CmmA$Worksheet.name$: public CmmAlert{                /* The Alert */
  875.     public:
  876.     virtual void    Init(void);                    /* Initialize the alert variables */
  877.     virtual void    HandleFirstTime(void);        /* Handle setup necessary for first time in */
  878.     virtual void    BringUpAlert(void);
  879.  
  880. $$Loop Control.type = Button
  881.     Boolean            Enable_$Control.name$;            /* ...Button global enable, $Control.FullName$ */
  882. $$EndLoop
  883. $$Loop Control.type = HotRect
  884.     Boolean            Enable_$Control.name$;            /* ...HotSpot global enable, $Control.FullName$ */
  885. $$EndLoop
  886. $$Loop Control.type = Icon
  887.     Boolean            Enable_$Control.name$;            /* ...Icon button global enable, $Control.FullName$ */
  888. $$EndLoop
  889. $$Loop Control.type = Picture
  890. $$if Control.NonGraphic
  891.     Boolean            Enable_$Control.name$;            /* ...Picture button global enable, $Control.FullName$ */
  892. $$endif
  893. $$EndLoop
  894. $$Loop Control.type = UButton
  895.     Boolean            Enable_$Control.name$;            /* ...Plugin Button global enable, $Control.FullName$ */
  896. $$EndLoop
  897. $$Loop Control.type = Sicn
  898.     Boolean            Enable_$Control.name$;            /* ...Sicn global enable, $Control.FullName$ */
  899. $$EndLoop
  900. };
  901.  
  902. $$EndLoop Alerts
  903. $$Loop ModalDialogs
  904. /* Class for the modal dialog titled  "$Worksheet.FullName$" */
  905. class CmmD$Worksheet.name$: public CmmModalDialog{            /* The Modal Dialog */
  906.     public:
  907.     virtual void    Init(void);                        /* Override, Initialize the Dialog variables */
  908.     virtual void    FilterMouseDown(DialogPtr theDialog,EventRecord *theEvent,short *itemHit,Point MyPt);
  909.     virtual void    Refresh(void);                    /* Update the Dialog */
  910.     virtual void    BringUpDialog(void);            /* Open the Dialog */
  911.  
  912. $$Loop Control.type = Button
  913.     Boolean            Enable_$Control.name$;            /* ...Button global enable, $Control.FullName$ */
  914. $$EndLoop
  915. $$Loop Control.type = Checkbox
  916.     Boolean            Enable_$Control.name$;            /* ...Checkbox global enable, $Control.FullName$ */
  917.     short            Value_$Control.name$;
  918. $$EndLoop
  919. $$Loop Control.type = Radio
  920.     Boolean            Enable_$Control.name$;            /* ...Radio global enable, $Control.FullName$ */
  921.     short            Value_$Control.name$;
  922. $$EndLoop
  923. $$Loop Control.type = ScrollBar
  924.     Boolean            Enable_$Control.name$;            /* ...ScrollBar global enable, $Control.FullName$ */
  925.     short            Value_$Control.name$;
  926. $$EndLoop
  927. $$Loop Control.type = Icon
  928.     Boolean            Enable_$Control.name$;            /* ...Icon button global enable, $Control.FullName$ */
  929. $$EndLoop
  930. $$Loop Control.type = Picture
  931. $$if Control.NonGraphic
  932.     Boolean            Enable_$Control.name$;            /* ...Picture button global enable, $Control.FullName$ */
  933. $$endif
  934. $$EndLoop
  935. $$Loop Control.type = EditText
  936.     TEHandle        TE_$Control.name$;                /* ...Edit Text, $Control.FullName$ */
  937.     Str255            TEStr_$Control.name$;
  938.     Rect            TERect_$Control.name$;
  939. $$EndLoop
  940. $$Loop Control.type = UButton
  941.     Boolean            Enable_$Control.name$;            /* ...Plugin Button global enable, $Control.FullName$ */
  942. $$EndLoop
  943. $$Loop Control.type = UToggle
  944.     Boolean            Enable_$Control.name$;            /* ...Plugin toggle global enable, $Control.FullName$ */
  945.     short            Value_$Control.name$;
  946. $$EndLoop
  947. $$Loop Control.type = UGauge
  948.     Boolean            Enable_$Control.name$;            /* ...Plugin guage global enable, $Control.FullName$ */
  949.     short            Value_$Control.name$;
  950. $$EndLoop
  951. $$Loop Control.type = List
  952.     ListHandle        List_$Control.name$;            /* ...List, $Control.FullName$ */
  953.     Rect            ListRect_$Control.name$;
  954. $$EndLoop
  955. $$Loop Control.type = Popup
  956.     Boolean            Enable_$Control.name$;            /* ...Popup menu global enable, $Control.FullName$ */
  957.     short            Value_$Control.name$;
  958. $$EndLoop
  959. $$Loop Control.type = Palette
  960.     Boolean            Enable_$Control.name$;            /* ...Palette global enable, $Control.FullName$ */
  961.     short            Value_$Control.name$;
  962. $$EndLoop
  963. $$Loop Control.type = HotRect
  964.     Boolean            Enable_$Control.name$;            /* ...HotSpot global enable, $Control.FullName$ */
  965.     Rect            Rect_$Control.name$;
  966. $$EndLoop
  967. $$Loop Control.type = Sicn
  968.     Boolean            Enable_$Control.name$;            /* ...Sicn global enable, $Control.FullName$ */
  969. $$EndLoop
  970. };
  971.  
  972. $$EndLoop
  973. $$Loop ModelessDialogs
  974. /* Class for the modeless dialog titled  "$Worksheet.FullName$" */
  975. class CmmMD$Worksheet.name$: public CmmModelessDialog{    /* The Modeless Dialog */
  976.     public:
  977.     virtual void    Init(void);                        /* Override, Initialize the Dialog variables */
  978.     virtual void    Update(WindowPtr theWindow);
  979.     virtual void    Open(void);
  980.     virtual void    Close(WindowPtr theWindow);
  981.     virtual void    HandleEvent(EventRecord *theEvent,WindowPtr theWindow,short itemHit);
  982.  
  983. $$Loop Control.type = Button
  984.     Boolean            Enable_$Control.name$;            /* ...Button global enable, $Control.FullName$ */
  985. $$EndLoop
  986. $$Loop Control.type = Checkbox
  987.     Boolean            Enable_$Control.name$;            /* ...Checkbox global enable, $Control.FullName$ */
  988.     short            Value_$Control.name$;
  989. $$EndLoop
  990. $$Loop Control.type = Radio
  991.     Boolean            Enable_$Control.name$;            /* ...Radio global enable, $Control.FullName$ */
  992.     short            Value_$Control.name$;
  993. $$EndLoop
  994. $$Loop Control.type = ScrollBar
  995.     Boolean            Enable_$Control.name$;            /* ...ScrollBar global enable, $Control.FullName$ */
  996.     short            Value_$Control.name$;
  997. $$EndLoop
  998. $$Loop Control.type = Icon
  999.     Boolean            Enable_$Control.name$;            /* ...Icon button global enable, $Control.FullName$ */
  1000. $$EndLoop
  1001. $$Loop Control.type = Picture
  1002. $$if Control.NonGraphic
  1003.     Boolean            Enable_$Control.name$;            /* ...Picture button global enable, $Control.FullName$ */
  1004. $$endif
  1005. $$EndLoop
  1006. $$Loop Control.type = EditText
  1007.     TEHandle        TE_$Control.name$;                /* ...Edit Text, $Control.FullName$ */
  1008.     Str255            TEStr_$Control.name$;
  1009.     Rect            TERect_$Control.name$;
  1010. $$EndLoop
  1011. $$Loop Control.type = UButton
  1012.     Boolean            Enable_$Control.name$;            /* ...Plugin Button global enable, $Control.FullName$ */
  1013. $$EndLoop
  1014. $$Loop Control.type = UToggle
  1015.     Boolean            Enable_$Control.name$;            /* ...Plugin toggle global enable, $Control.FullName$ */
  1016.     short            Value_$Control.name$;
  1017. $$EndLoop
  1018. $$Loop Control.type = UGauge
  1019.     Boolean            Enable_$Control.name$;            /* ...Plugin guage global enable, $Control.FullName$ */
  1020.     short            Value_$Control.name$;
  1021. $$EndLoop
  1022. $$Loop Control.type = List
  1023.     ListHandle        List_$Control.name$;            /* ...List, $Control.FullName$ */
  1024.     Rect            ListRect_$Control.name$;
  1025. $$EndLoop
  1026. $$Loop Control.type = Popup
  1027.     Boolean            Enable_$Control.name$;            /* ...Popup menu global enable, $Control.FullName$ */
  1028.     short            Value_$Control.name$;
  1029. $$EndLoop
  1030. $$Loop Control.type = Palette
  1031.     Boolean            Enable_$Control.name$;            /* ...Palette global enable, $Control.FullName$ */
  1032.     short            Value_$Control.name$;
  1033. $$EndLoop
  1034. $$Loop Control.type = HotRect
  1035.     Boolean            Enable_$Control.name$;            /* ...HotSpot global enable, $Control.FullName$ */
  1036.     Rect            Rect_$Control.name$;
  1037. $$EndLoop
  1038. $$Loop Control.type = Sicn
  1039.     Boolean            Enable_$Control.name$;            /* ...Sicn global enable, $Control.FullName$ */
  1040. $$EndLoop
  1041. };
  1042.  
  1043. $$EndLoop
  1044. $$Loop Windows
  1045. /* Class for the window titled  "$Worksheet.FullName$" */
  1046. typedef struct $Worksheet.name$Rec{                /* Record for window instance */
  1047.     WindowPtr        theWindow;                    /* Window pointer */
  1048.     struct $Worksheet.name$Rec    *Next;
  1049.     Handle            ExtrasHdl;                    /* Not used by MM code, dedicated to user code */
  1050.     RGBColor        WindowBackColor;            /* Background window color */
  1051. $$if Worksheet.Document
  1052. $$if Worksheet.ScrollHorz
  1053.     ControlHandle    ScrollHHandle;                    /* Scrollbar for horz scrolling */
  1054.     short            ScrollHLeftOffset;                /* Offset of control from left side */
  1055. $$endif
  1056. $$if Worksheet.ScrollVert
  1057.     ControlHandle    ScrollVHandle;                    /* Scrollbar for vert scrolling */
  1058.     short            ScrollVTopOffset;                /* Offset of control from top edge */
  1059. $$endif
  1060. $$endif
  1061. $$Loop Control.type = Button
  1062.     ControlHandle    Ctrl_$Control.name$;            /* ...Button, $Control.FullName$ */
  1063.     Boolean            Enable_$Control.name$;
  1064. $$EndLoop
  1065. $$Loop Control.type = Checkbox
  1066.     ControlHandle    Ctrl_$Control.name$;            /* ...Checkbox, $Control.FullName$ */
  1067.     Boolean            Enable_$Control.name$;
  1068.     short            Value_$Control.name$;
  1069. $$EndLoop
  1070. $$Loop Control.type = Radio
  1071.     ControlHandle    Ctrl_$Control.name$;            /* ...Radio, $Control.FullName$ */
  1072.     Boolean            Enable_$Control.name$;
  1073.     short            Value_$Control.name$;
  1074. $$EndLoop
  1075. $$Loop Control.type = ScrollBar
  1076.     ControlHandle    Ctrl_$Control.name$;            /* ...ScrollBar, $Control.FullName$ */
  1077.     Boolean            Enable_$Control.name$;
  1078.     short            Value_$Control.name$;
  1079. $$EndLoop
  1080. $$Loop Control.type = Icon
  1081. $$if Control.NonGraphic
  1082.     ControlHandle    Ctrl_$Control.name$;            /* ...Icon button, $Control.FullName$ */
  1083.     Boolean            Enable_$Control.name$;
  1084. $$endif
  1085. $$EndLoop
  1086. $$Loop Control.type = Picture
  1087. $$if Control.NonGraphic
  1088.     ControlHandle    Ctrl_$Control.name$;            /* ...Picture button, $Control.FullName$ */
  1089.     Boolean            Enable_$Control.name$;
  1090. $$endif
  1091. $$EndLoop
  1092. $$Loop Control.type = EditText
  1093.     TEHandle        TE_$Control.name$;                /* ...Edit Text, $Control.FullName$ */
  1094.     Str255            TEStr_$Control.name$;
  1095.     Rect            TERect_$Control.name$;
  1096. $$EndLoop
  1097. $$Loop Control.type = UButton
  1098.     ControlHandle    Ctrl_$Control.name$;            /* ...Plugin Button, $Control.FullName$ */
  1099.     Boolean            Enable_$Control.name$;
  1100. $$EndLoop
  1101. $$Loop Control.type = UToggle
  1102.     ControlHandle    Ctrl_$Control.name$;            /* ...Plugin toggle, $Control.FullName$ */
  1103.     Boolean            Enable_$Control.name$;
  1104.     short            Value_$Control.name$;
  1105. $$EndLoop
  1106. $$Loop Control.type = UGauge
  1107.     ControlHandle    Ctrl_$Control.name$;            /* ...Plugin guage, $Control.FullName$ */
  1108.     Boolean            Enable_$Control.name$;
  1109.     short            Value_$Control.name$;
  1110. $$EndLoop
  1111. $$Loop Control.type = List
  1112.     ListHandle        List_$Control.name$;            /* ...List, $Control.FullName$ */
  1113.     Rect            ListRect_$Control.name$;
  1114. $$EndLoop
  1115. $$Loop Control.type = Popup
  1116.     ControlHandle    Ctrl_$Control.name$;            /* ...Popup menu, $Control.FullName$ */
  1117.     Boolean            Enable_$Control.name$;
  1118.     short            Value_$Control.name$;
  1119. $$EndLoop
  1120. $$Loop Control.type = Palette
  1121.     ControlHandle    Ctrl_$Control.name$;            /* ...Palette, $Control.FullName$ */
  1122.     Boolean            Enable_$Control.name$;
  1123.     short            Value_$Control.name$;
  1124. $$EndLoop
  1125. $$Loop Control.type = HotRect
  1126.     ControlHandle    Ctrl_$Control.name$;            /* ...HotSpot, $Control.FullName$ */
  1127.     Boolean            Enable_$Control.name$;
  1128.     Rect            Rect_$Control.name$;
  1129. $$EndLoop
  1130. $$Loop Control.type = Sicn
  1131.     ControlHandle    Ctrl_$Control.name$;            /* ...Sicn, $Control.FullName$ */
  1132.     Boolean            Enable_$Control.name$;
  1133. $$EndLoop
  1134. }$Worksheet.name$Rec,*$Worksheet.name$PRec;
  1135. class CmmW$Worksheet.name$: public CmmWindow{                    /* The window */
  1136.     public:
  1137.     virtual void    Init(void);                        /* Override, Initialize the window variables */
  1138.     virtual void    InitRecord($Worksheet.name$PRec theWS);
  1139.     virtual void    LocateInstance(WindowPtr theWindow);
  1140.     virtual void    Open(void);                        /* Open the window */
  1141.     virtual void    Close(WindowPtr theWindow);        /* Close the window */
  1142.     virtual void    Resized(Rect *OldRect,WindowPtr whichWindow);            /* The window was zoomed or resized */
  1143.     virtual void    Update(WindowPtr whichWindow);    /* Update the window */
  1144.     virtual void    Activate(WindowPtr whichWindow,Boolean Do_An_Activate);    /* Activate the window */
  1145.     virtual void    HandleButton(WindowPtr whichWindow,ControlHandle theControl);        /* Handle a button being pressed */
  1146. $$if Worksheet.CheckboxesOrRadios
  1147.     virtual void    HandleCheckbox(WindowPtr whichWindow,ControlHandle theControl);
  1148. $$endif
  1149. $$if Worksheet.Scrollbars
  1150.     virtual void    HandleScrollBar(short code,ControlHandle theControl,Point myPt);
  1151. $$endif
  1152.     virtual void    HandleEvent(EventRecord *myEvent);
  1153.  
  1154.     $Worksheet.name$PRec    ListRecPtr;        /* List of instance records */
  1155.     $Worksheet.name$PRec    RecPtr;            /* Current active instance */
  1156. };
  1157.  
  1158. $$EndLoop
  1159.  
  1160. class CmmApplication{                /* The Application itself */
  1161.     public:
  1162.     virtual void    Init(void);                        /* Initialize the application */
  1163.     virtual void    InitExtras(void);                /* HOOK, Extra user initialization */
  1164.  
  1165.     virtual void    Run(void);                        /* Main event loop */
  1166.     virtual void    TopOfLoop(void);                /* HOOK at top of main event loop */
  1167.     virtual void    FilterEvent(Boolean *DoIt,EventRecord *myEvent);    /* HOOK, Filter events from the main loop */
  1168.     virtual void    DoHighLevelEvent(EventRecord *myEvent);    /* Do an AppleEvent */
  1169.     virtual Boolean    DoActivate(EventRecord *myEvent);    /* Handle Activate and Deactivate events */
  1170.     virtual Boolean    DoUpdate(EventRecord *myEvent);    /* Handle Update events */
  1171.     virtual Boolean    DoInContent(WindowPtr whichWindow,EventRecord *myEvent);    /* Pressed in the content area */
  1172.     virtual Boolean    DoGoAway(WindowPtr whichWindow,EventRecord *myEvent);    /* Close a window */
  1173.     virtual Boolean    DoDrag(WindowPtr whichWindow,EventRecord *myEvent);    /* Drag a window around */
  1174.     virtual Boolean    DoGrow(WindowPtr whichWindow,EventRecord *myEvent);    /* Handle a window resize */
  1175.     virtual Boolean    DoZoom(WindowPtr whichWindow,short code,EventRecord *myEvent);    /* Handle a window zoom */
  1176.     virtual void    DoDiskEvent(EventRecord *myEvent);        /* Handle disk inserted */
  1177.     virtual void    DoKeyEvent(EventRecord *myEvent);        /* Handle key presses */
  1178.     virtual void    Handle_User_Event(void);                /* Handle a user event */
  1179.     virtual void    Handle_Extra_User_Event(UserEventPRec theUserEvent);    /* Hook, to handle user events */
  1180.     virtual void    DoOSEvent(EventRecord *myEvent);        /* Check suspend and resume */
  1181.     virtual Boolean    IsWNEIsImplemented(void);                /* See if WaitNextEvent is available */
  1182.     virtual void    OpenSplashWindow(void);            /* Open spash or personalization window */
  1183.     virtual void    CloseSplashWindow(void);        /* Close spash or personalization window */
  1184.     virtual void    InitAppleEvents(void);                        /* Init appleEvent handlers */
  1185.     
  1186.     virtual void    Exit(void);                        /* Exit the application */
  1187.     virtual void    ExitExtras(void);                /* HOOK, Extra user exit code */
  1188. };
  1189.  
  1190.  
  1191. class CmmMenus{                    /* The Menu bar handler */
  1192.     public:
  1193.     virtual void    Init(void);                        /* Initialize the menus */
  1194.     virtual void    AddExtraMenus(void);            /* HOOK, Extra user initialization */
  1195.     virtual Boolean    HandleMenuSelection(short theMenu,short theItem);    /* Select a menu */
  1196.     virtual void    EnableTheMenus(void);            /* Enable or disable before they are dropped */
  1197.  
  1198. $$Loop Menus
  1199.     virtual Boolean    DoMenu$Menu.name$(short theItem);    /* Handle this menu list, $Menu.FullName$ */
  1200. $$EndLoop Menus
  1201. $$Loop HierMenus
  1202.     virtual Boolean    DoMenu$Menu.name$(short theItem);    /* Handle this menu list, $Menu.FullName$ */
  1203. $$EndLoop HierMenus
  1204. };
  1205.  
  1206. class CmmPreferences{                /* The Preferences routines */
  1207.     public:    
  1208.     virtual void    Init(void);                /* Initialize the variables */
  1209.     virtual void    GetPreferences(void);    /* Get prefs from file */
  1210.     virtual void    SetPreferences(void);    /* Send out new prefs */
  1211.     virtual void    GetPrefParams(OSType *PrefCreator,OSType *PrefType,
  1212.         Str255 *thePrefsFilename,long *PrefsRecSize,short *thePrefsFormatRevision);
  1213.     virtual void    ReadPrefsPrivate(short PrefsRefNum);    /* Override reading prefs file */
  1214.     virtual void    UGetPreferences(Handle thePrefsH);    /* Pull all data from prefs record */
  1215.     virtual void    USetPreferences(Handle thePrefsH);    /* Set prefs record before it is written */
  1216. };
  1217.  
  1218. class CmmFiles{                    /* The Files routines */
  1219.     public:    
  1220.     FileRec            Files;                    /* Reading and writing files */
  1221.  
  1222.     virtual void    Init(void);                /* Initialize the variables */
  1223.     /* Open a file, user selects the file */
  1224.     virtual Boolean Do_The_Open_File(short NumberOfTypes,short *theVolRefNum,ProcPtr fileFilter,
  1225.         ProcPtr dlgHook);
  1226.     /* Save to a file, user selects the file */
  1227.     virtual Boolean Do_The_Save_File(OSType creator, OSType fileType,Str255 *Prompt,
  1228.         Str255 *DefaultName,short *theVolRefNum,short *theRefNum,ProcPtr dlgHook);
  1229.     virtual Boolean Do_The_Select_Volume (FSSpec *theFile);    /* Select a volume */
  1230.     virtual void Close_The_Input_File(void);
  1231.     virtual void Open_The_File(void);
  1232.     virtual void Close_The_Output_File(void);
  1233.     virtual void Save_The_File(void);
  1234.     virtual void Select_Volume(void);
  1235. };
  1236.  
  1237. class CmmPrinting{                /* The Printing routines */
  1238.     public:    
  1239.     PrintingRec        Printing;                /* Printing */
  1240.  
  1241.     virtual void    Init(void);                /* Initialize the variables */
  1242.     virtual void    PageSetup(void);        /* Do the page setup */
  1243.     virtual void    PrintJobSetup(void);    /* Do the print job setup */
  1244.     virtual void    OpenThePrinter(Boolean *Cancelled);    /* Open the printer and driver for use */
  1245.     virtual void    CloseThePrinter(void);    /* Close the printer and driver */
  1246.     virtual void    Print_The_Data(void);
  1247. };
  1248.  
  1249. /* ======================================================= */
  1250. /* ======================================================= */
  1251.  
  1252. $$CloseFile
  1253. $$Message MM Common, mm:mmCommon$Prototype.name$.h
  1254. $$File mm:mmCommon$Prototype.name$.h
  1255. /*  $CopyRight$ */
  1256. /*   mmCommon$Prototype.name$                            Common and Utilitys
  1257.  
  1258.     Name:  mmCommon$Prototype.name$.h
  1259.     Function:  Common for the Marksman¬ specific code.
  1260.     History: $Date$ Original by $Author$
  1261.  
  1262. */
  1263.  
  1264. /* ======================================================= */
  1265. /* ======================================================= */
  1266.  
  1267. extern CApplication        *gApplication;                /* The application itself */
  1268. extern CMenus            *gMenus;                    /* Menu handler */
  1269. extern CPreferences        *gPreferences;                /* Preferences handler */
  1270. extern CFiles            *gFiles;                    /* Files handler */
  1271. extern CPrinting        *gPrinting;                    /* Printing handler */
  1272.  
  1273. extern UserEventHRec    UserEventList;                /* User Event record list start */
  1274. extern EventRecord        myEvent;                    /* Event record for all events */
  1275. extern Boolean            WNE;                        /* WaitNextEvent trap is available */
  1276. extern short            SleepValue;                    /* Sleep value for Wait on events */
  1277. extern Boolean            doneFlag;                    /* Exit program flag */
  1278. extern TEHandle            theInput;                    /* Used in text edit selections */
  1279. extern RgnHandle        cursorRgn;                    /* Cursor region for WaitNextEvent */
  1280. extern short            ReplyMode;                    /* Reply mode for AppleEvents */
  1281.  
  1282. extern Rect                tempRect;                    /* Temporary rect, not for long term use */
  1283. extern Str255            sTemp;                        /* Temporary string, not for long term use */
  1284. extern short            tempChar;                    /* Temporary use character */
  1285. extern long                LTemp;                        /* Temporary use long variable */
  1286. extern short            DType;                        /* Temporary use Type of dialog item */
  1287. extern Handle            DItem;                        /* Temporary use Handle to the dialog item */
  1288. extern ControlHandle    CItem;                        /* Temporary use Control handle */
  1289.  
  1290. extern WindowLocRec        theWindowLocRec;
  1291.  
  1292. extern Boolean            Doing_MovableModal;            /* For Movable Modal dialogs */
  1293. extern Boolean            HoldOffUserEvents;            /* Flag for holding off UserEvents */
  1294. extern Boolean            InTheForeground;            /* Flag for running in MultiFinder foreground */
  1295.  
  1296. extern HasRec            Has;                        /* Gestalt check results */
  1297.  
  1298. extern RGBColor            Black_ForeColor,White_BackColor;/* Standard colors */
  1299. extern RGBColor            DrawingColor;                /* Temp drawing color, short life span use only */
  1300.  
  1301. extern ProcessSerialNumber        gSelfPSN;
  1302. extern AEAddressDesc                    gSelfAddress;
  1303.  
  1304. $$Loop Menus
  1305. extern MenuHandle    Menu_$Menu.name$;                    /* Menu handle, $Menu.FullName$ */
  1306. $$EndLoop
  1307.  
  1308. $$Loop HierMenus
  1309. extern MenuHandle    Menu_$Menu.name$;                    /* Hier Menu handle, $Menu.FullName$ */
  1310. $$EndLoop
  1311.  
  1312. extern CmmAlert                    *gCurrentAlert;            /* The current Alert object */
  1313. $$Loop Alerts
  1314. extern CA$Worksheet.name$        *g$Worksheet.name$;        /* The Alert object */
  1315. $$EndLoop Alerts
  1316. extern CmmModalDialog            *gCurrentModalDialog;    /* The current Modal Dialog object */
  1317. $$Loop ModalDialogs
  1318. extern CD$Worksheet.name$        *g$Worksheet.name$;        /* The Modal Dialog object */
  1319. $$EndLoop
  1320. $$Loop ModelessDialogs
  1321. extern CMD$Worksheet.name$        *g$Worksheet.name$;        /* The Modeless Dialog object */
  1322. $$EndLoop
  1323. $$Loop Windows
  1324. extern CW$Worksheet.name$        *g$Worksheet.name$;        /* The Window object that is active */
  1325. $$EndLoop
  1326.  
  1327.  
  1328. #ifdef __cplusplus
  1329. extern "C" {
  1330. #endif
  1331.  
  1332. /* Prototypes */
  1333. pascal Boolean theAlertFilter (DialogPtr theDialog,EventRecord *theEvent,short *itemHit);
  1334. pascal Boolean theModalDialogFilter(DialogPtr theDialog,EventRecord *theEvent,short *itemHit);
  1335.  
  1336. /* Copy Pascal strings */
  1337. void PStrCopy(Str255 *SourceString, Str255 *DestString);
  1338.  
  1339. /* Concat Pascal strings */
  1340. void PStrCat(Str255 *SourceString, Str255 *DestString);
  1341.  
  1342. /* Compare Pascal strings for exact match, case sensitive */
  1343. Boolean PStrCmp(StringPtr Source1String,StringPtr Source2String);
  1344.  
  1345. WindowPtr Mk_BehindWindow(short theLayer);            /* Get which window to place us behind */
  1346. void Mk_RegisterWindow(WindowPtr theWindowPtr,short theLayer);/* Place layer in RefCon and verify layers */
  1347. void Mk_ClearLayers(void);                            /* Init our arrays for layered windows */
  1348. void Mk_HiliteWindow(WindowPtr theWindowPtr);        /* Hilite our layered window */
  1349. void Mk_DragWindow(WindowPtr theWindowPtr,Point where, Rect bounds);/* Drag our layered window */
  1350. Boolean Mk_Is_FrontWindow(WindowPtr theWindowPtr);    /* Get the front window */
  1351. void Mk_CloseLayeredWindow(WindowPtr theWindowPtr);/* Close a layered window */
  1352.  
  1353. void Play_The_Sound(short ResID);
  1354.  
  1355. void PositionWindow(WindowPtr theWindow,Point  WantLocation,Point DefaultPosition);
  1356.  
  1357. /* See if any user events are available */
  1358. void GetUserEvent(UserEventPRec TheUserEvent);
  1359.  
  1360. /* Add a user event */
  1361. void Add_UserEvent(short ID, short ID2, long  Data1, long Data2, Handle  theHandle);
  1362.  
  1363. /* Set the title for a popup control */
  1364. void SetNameForPopup(ControlHandle theControl);
  1365.  
  1366. /* This is a routine used to make a new list */
  1367. void Make_A_List(ListHandle *theList,Rect *theListRect,WindowPtr theWindow,short theStringResourceID,
  1368.     short theSize,short theFont,Style theStyle,Boolean InDialog);
  1369.  
  1370. /* This is a routine used to add strings to an existing list */
  1371. void Add_List_String(Str255 theString, ListHandle theList, Point *cSize);
  1372.  
  1373. /* This is a routine used to get a string from a TE area, limited to 250 characters */
  1374. void Get_TE_String(TEHandle theTEArea, Str255 *theString);
  1375.  
  1376. /* This is a routine used to create a TE area */
  1377. void Make_TE_Area(TEHandle *theTEArea, Rect *Position,short theFontSize,short theFont,
  1378.     short DefaultStringID);
  1379.  
  1380. /* This is a routine used to plot an Sicn, small 16x16 icon */
  1381. void Plot_Sicn(short theSicnID, Rect *Position);
  1382.  
  1383. /* This is a routine used to handle a scrollbar */
  1384. void HandleWScrollBar(Point myPt,short code,short Increment,short LIncrement,ControlHandle theControl);
  1385.  
  1386. /* Setup a dialog or alert item */
  1387. void SetupTheItem (DialogPtr theDialog,short ItemID,Boolean SizeIt,Boolean ShowIt, 
  1388.     Boolean EnableIt,Boolean SetTheMax,Rect *thePosition ,long ExtraData ,short StringID );
  1389.  
  1390. /* Center a window onto the deepest color screen */
  1391. void CenterOnColorScreen(WindowPtr theWindow);
  1392.  
  1393. /* Get the deepest color screen rect */
  1394. void GetDeepestColorScreenRect(Rect *DeepRect);
  1395.  
  1396. /* Alert and Dialog support routines */
  1397. void HiliteDefaultButton(DialogPtr theDialog,short theItem);
  1398. void CheckKeysInDialog(DialogPtr theDialog,Boolean *valMyFilter,EventRecord *theEvent,short *itemHit);
  1399. void SetupNormalControl(DialogPtr theDialog,short theItem,Boolean Enabled,short InitialValue);
  1400. void SetupHotSpot(DialogPtr theDialog,short theItem,Boolean MakeHotSpot,long LineWidth,
  1401.     long ShadowWidth,short MessageResID,Boolean Enabled);
  1402. void SetupPlugin(DialogPtr theDialog,short theItem,Boolean Enabled,
  1403.     long NormalID,long HilitedID,short MessageResID);
  1404. void SetupMinMaxValue(DialogPtr theDialog,short theItem,short min,short max,short value);
  1405. void SetupPopupMenu(DialogPtr theDialog,short theItem,Boolean Enabled,short theMenuID,short value);
  1406. void SetupPalette(DialogPtr theDialog,short theItem,Boolean Enabled,long NumberRows,long NumberCols,
  1407.     long PalPictureID,long HiliteMethod);
  1408. void SetupIconSicn(DialogPtr theDialog,short theItem,Boolean Enabled,
  1409.     long NormalID,long HilitedID);
  1410. void ClearTheRadio(DialogPtr theDialog,short theItem,short *value);
  1411.  
  1412. /* Window support routines */
  1413. void DrawStaticTextBox(short ResID,Rect *theRect,short Justify,short theSize,short theFont,Style theStyle);
  1414. void DrawStaticLine(short ResID,short Left,short Top,short theSize,short theFont,Style theStyle);
  1415. void DrawTheTEArea(Rect *theTERect,TEHandle theTE,short theSize,short theFont,Style theStyle);
  1416. ControlHandle MakeNormalControl(WindowPtr theWindow,short theResID,Boolean Enabled,short InitialValue);
  1417. ControlHandle MakeHotSpot(WindowPtr theWindow,short theResID,Boolean MakeHotSpot,long LineWidth,
  1418.     long ShadowWidth,short MessageResID,Boolean Enabled);
  1419. ControlHandle MakeIconSicn(WindowPtr theWindow,short theResID,Boolean Enabled,
  1420.     long NormalID,long HilitedID);
  1421. ControlHandle MakePlugin(WindowPtr theWindow,short theResID,Boolean Enabled,
  1422.     long NormalID,long HilitedID,short MessageResID,short InitialValue);
  1423. void MakeMinMaxValue(ControlHandle theControl,short min,short max,short value);
  1424. ControlHandle MakePopupMenu(WindowPtr theWindow,short theResID,Boolean Enabled,short theMenuID,short value);
  1425. ControlHandle MakePalette(WindowPtr theWindow,short theResID,Boolean Enabled,long NumberRows,long NumberCols,
  1426.     long PalPictureID,long HiliteMethod);
  1427.  
  1428. void UpdateTheList(RgnHandle theRgn,ListHandle theList,Rect *theRect,short theSize,short theFont,Style theStyle,Boolean InDialog);
  1429. void ClickInTheList(Point myPt,short modifiers,ListHandle theList,short theSize,short theFont,Style theStyle,Boolean InDialog);
  1430. void Activate_TE_Area(Boolean InDialog,Point myPt,TEHandle theTE,short textSize,short textFont,Style textStyle);
  1431.  
  1432. pascal OSErr DispatchAppleEvent(AppleEvent *message,AppleEvent *reply,long refcon);
  1433. OSErr AE_OpenedApplication(AppleEvent *message,AppleEvent *reply,long refcon);
  1434. OSErr AE_QuittingApplication(AppleEvent *message,AppleEvent *reply,long refcon);
  1435. Boolean MissedAnyParameters(AppleEvent *message);
  1436. void AE_OpenThisFile(FSSpec *theFSSpec,short WhichFile,short TotalToOpen);
  1437. void AE_PrintThisFile(FSSpec *theFSSpec,short WhichFile,short TotalToOpen);
  1438.  
  1439. #ifdef __cplusplus
  1440. }
  1441. #endif
  1442.  
  1443. /* ======================================================= */
  1444. /* ======================================================= */
  1445.  
  1446. $$CloseFile
  1447.  
  1448.  
  1449.